package com.bms.zuul.exception;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * @author thinknovo
 * @version 1.0
 * @description ExceptionControllerAdvice.java
 */
@ControllerAdvice
@ResponseBody
public class ExceptionControllerAdvice {
    @ExceptionHandler
    @ResponseBody
    public Map<String, Object> check(Throwable e) {
        e.printStackTrace();
        Map<String, Object> map = new HashMap<>();
        map.put("code", 500);
        map.put("msg", e.getMessage());
        return map;
    }
}
